/**
 * Copyright ©2003~2019年7月24日 szkingdom
 * @author raohj
 * @date 2019年7月24日
 * @file RBeanTest.java
 * @comment : please input your comment to this file
 * @version : input version
 * @modify:
 * 		1、 2019年7月24日 由 raohj 新建文件
 */
package com.ccnu.demojava.spring.framework.beans;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author raohj
 * @date 2019年7月24日
 * @version 
 * @comment to add your comment
 */
public class RBeanTest {
	private static final Logger log = LoggerFactory.getLogger(RBeanTest.class);
	public static void test() {
		// 调用Spring框架的ApplicationContext加载配置文件
		ApplicationContext context = new ClassPathXmlApplicationContext("spring-bean.xml");
		String[] strBeans = context.getBeanDefinitionNames();
		log.info("打印所有加载的Beans");
		for (String strBean : strBeans) {
			log.info(strBean);
		}
		
		log.info("获取RBeanContruct的实例Bean");
		RBeanContruct rb = (RBeanContruct) context.getBean("RBeanContruct");
		if(rb!=null) {
			log.info(rb.getBeanName());
		}
		
		log.info("获取RBeanRef的实例Bean");
		RBeanRef rbf = (RBeanRef) context.getBean("RBeanRef");
		if(rb!=null) {
			log.info(rbf.getRefName());
		}
		
		log.info("获取RBeanLazyInit的实例Bean");
		RBeanLazyInit rbLI = (RBeanLazyInit) context.getBean("RBeanLazyInit");
		
		RBeanLifeFullCycle rbLFC = (RBeanLifeFullCycle) context.getBean("RBeanLifeFullCycle");
	}
}
